package com.tingfeng.examservice.controller;

import com.tingfeng.examservice.model.dto.LoginRequest;
import com.tingfeng.examservice.model.dto.LoginResponse;
import com.tingfeng.examservice.service.AuthService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

@RestController
@RequestMapping("/api/auth")
public class WxAuthController {
    @Autowired
    private AuthService authService;

    @PostMapping("/wxLogin")
    public LoginResponse wxLogin(@RequestBody LoginRequest request){
        return authService.wxLogin(request);
    }

    @GetMapping("/wxUserInfo")
    public LoginResponse getUserInfo(@RequestHeader("Authorization") String token){
        return authService.getUserInfo(token);
    }


}
